import request from '@/utils/request'
import { SmsChannelVO, SmsTemplateVO, SendSmsReqVO } from '@/api/system/sms/types'

// 查询短信模板列表
export const getSmsTemplatePage = (data) => {
  return request({
    url: '/sms/smsTemplate/list',
    method: 'post',
    data,
  })
}

// 查询短信模板详情
export const getSmsTemplate = (data) => {
  return request({ url: '/sms/smsTemplate/getDetail', method: 'post', data })
}

// 新增短信模板
export const createSmsTemplate = (data: SmsTemplateVO) => {
  return request({ url: '/sms/smsTemplate/add', method: 'post', data })
}

// 修改短信模板
export const updateSmsTemplate = (data: SmsTemplateVO) => {
  return request({ url: '/sms/smsTemplate/edit', method: 'post', data })
}

// 删除短信模板
export const deleteSmsTemplate = (data: number[]) => {
  return request({ url: '/sms/smsTemplate/delete', method: 'post', data })
}

// 导出短信模板
export const exportSmsTemplate = (data) => {
  return request({
    url: '/sms/smsTemplate/export-excel',
    method: 'post',
    data,
  })
}

// 发送短信
export const sendSms = (data: SendSmsReqVO) => {
  return request({ url: '/sms/smsTemplate/send-sms', method: 'post', data })
}

// 查询短信渠道列表
export const getSmsChannelPage = (data) => {
  return request({ url: '/sms/smsChannel/list', method: 'post', data })
}

// 获得短信渠道精简列表
export function getSimpleSmsChannelList() {
  return request({ url: '/sms/smsChannel/list-all-simple', method: 'post' })
}

// 查询短信渠道详情
export const getSmsChannel = (data) => {
  return request({ url: '/sms/smsChannel/getDetail', method: 'post', data })
}

// 新增短信渠道
export const createSmsChannel = (data) => {
  return request({ url: '/sms/smsChannel/add', method: 'post', data })
}

// 修改短信渠道
export const updateSmsChannel = (data) => {
  return request({ url: '/sms/smsChannel/edit', method: 'post', data })
}

// 删除短信渠道
export const deleteSmsChannel = (data) => {
  return request({ url: '/sms/smsChannel/delete', method: 'post', data })
}
